

<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Remarks &#8212; LLVM 9 documentation</title>
    <link rel="stylesheet" href="_static/llvm-theme.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
    <script src="_static/jquery.js"></script>
    <script src="_static/underscore.js"></script>
    <script src="_static/doctools.js"></script>
    <script src="_static/language_data.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="LLVM Atomic Instructions and Concurrency Guide" href="Atomics.html" />
    <link rel="prev" title="Building a Distribution of LLVM" href="BuildingADistribution.html" />
<style type="text/css">
  table.right { float: right; margin-left: 20px; }
  table.right td { border: 1px solid #ccc; }
</style>

  </head><body>
<div class="logo">
  <a href="index.html">
    <img src="_static/logo.png"
         alt="LLVM Logo" width="250" height="88"/></a>
</div>

    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="Atomics.html" title="LLVM Atomic Instructions and Concurrency Guide"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="BuildingADistribution.html" title="Building a Distribution of LLVM"
             accesskey="P">previous</a> |</li>
  <li><a href="http://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="index.html">Documentation</a>&raquo;</li>

        <li class="nav-item nav-item-this"><a href="">Remarks</a></li> 
      </ul>
    </div>


    <div class="document">
      <div class="documentwrapper">
          <div class="body" role="main">
            
  <div class="section" id="remarks">
<h1>Remarks<a class="headerlink" href="#remarks" title="Permalink to this headline">¶</a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><p><a class="reference internal" href="#introduction-to-the-llvm-remark-diagnostics" id="id1">Introduction to the LLVM remark diagnostics</a></p></li>
<li><p><a class="reference internal" href="#enabling-optimization-remarks" id="id2">Enabling optimization remarks</a></p>
<ul>
<li><p><a class="reference internal" href="#remark-diagnostics" id="id3">Remark diagnostics</a></p></li>
<li><p><a class="reference internal" href="#serialized-remarks" id="id4">Serialized remarks</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#yaml-remarks" id="id5">YAML remarks</a></p></li>
<li><p><a class="reference internal" href="#opt-viewer" id="id6">opt-viewer</a></p>
<ul>
<li><p><a class="reference internal" href="#opt-viewer-py" id="id7">opt-viewer.py</a></p></li>
<li><p><a class="reference internal" href="#opt-stats-py" id="id8">opt-stats.py</a></p></li>
<li><p><a class="reference internal" href="#opt-diff-py" id="id9">opt-diff.py</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#emitting-remark-diagnostics-in-the-object-file" id="id10">Emitting remark diagnostics in the object file</a></p></li>
<li><p><a class="reference internal" href="#c-api" id="id11">C API</a></p></li>
</ul>
</div>
<div class="section" id="introduction-to-the-llvm-remark-diagnostics">
<h2><a class="toc-backref" href="#id1">Introduction to the LLVM remark diagnostics</a><a class="headerlink" href="#introduction-to-the-llvm-remark-diagnostics" title="Permalink to this headline">¶</a></h2>
<p>LLVM is able to emit diagnostics from passes describing whether an optimization
has been performed or missed for a particular reason, which should give more
insight to users about what the compiler did during the compilation pipeline.</p>
<p>There are three main remark types:</p>
<p><code class="docutils literal notranslate"><span class="pre">Passed</span></code></p>
<blockquote>
<div><p>Remarks that describe a successful optimization performed by the compiler.</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p></p></dd>
</dl>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">foo</span> <span class="n">inlined</span> <span class="n">into</span> <span class="n">bar</span> <span class="k">with</span> <span class="p">(</span><span class="n">cost</span><span class="o">=</span><span class="n">always</span><span class="p">):</span> <span class="n">always</span> <span class="n">inline</span> <span class="n">attribute</span>
</pre></div>
</div>
</div></blockquote>
<p><code class="docutils literal notranslate"><span class="pre">Missed</span></code></p>
<blockquote>
<div><p>Remarks that describe an attempt to an optimization by the compiler that
could not be performed.</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p></p></dd>
</dl>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">foo</span> <span class="ow">not</span> <span class="n">inlined</span> <span class="n">into</span> <span class="n">bar</span> <span class="n">because</span> <span class="n">it</span> <span class="n">should</span> <span class="n">never</span> <span class="n">be</span> <span class="n">inlined</span>
<span class="p">(</span><span class="n">cost</span><span class="o">=</span><span class="n">never</span><span class="p">):</span> <span class="n">noinline</span> <span class="n">function</span> <span class="n">attribute</span>
</pre></div>
</div>
</div></blockquote>
<p><code class="docutils literal notranslate"><span class="pre">Analysis</span></code></p>
<blockquote>
<div><p>Remarks that describe the result of an analysis, that can bring more
information to the user regarding the generated code.</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p></p></dd>
</dl>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">16</span> <span class="n">stack</span> <span class="nb">bytes</span> <span class="ow">in</span> <span class="n">function</span>
</pre></div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">10</span> <span class="n">instructions</span> <span class="ow">in</span> <span class="n">function</span>
</pre></div>
</div>
</div></blockquote>
</div>
<div class="section" id="enabling-optimization-remarks">
<h2><a class="toc-backref" href="#id2">Enabling optimization remarks</a><a class="headerlink" href="#enabling-optimization-remarks" title="Permalink to this headline">¶</a></h2>
<p>There are two modes that are supported for enabling optimization remarks in
LLVM: through remark diagnostics, or through serialized remarks.</p>
<div class="section" id="remark-diagnostics">
<h3><a class="toc-backref" href="#id3">Remark diagnostics</a><a class="headerlink" href="#remark-diagnostics" title="Permalink to this headline">¶</a></h3>
<p>Optimization remarks can be emitted as diagnostics. These diagnostics will be
propagated to front-ends if desired, or emitted by tools like <a class="reference internal" href="CommandGuide/llc.html"><span class="doc">llc</span></a> or <a class="reference internal" href="CommandGuide/opt.html"><span class="doc">opt</span></a>.</p>
<dl class="std option">
<dt id="cmdoption-pass-remarks">
<code class="sig-name descname">-pass-remarks</code><code class="sig-prename descclassname">=&lt;regex&gt;</code><a class="headerlink" href="#cmdoption-pass-remarks" title="Permalink to this definition">¶</a></dt>
<dd><p>Enables optimization remarks from passes whose name match the given (POSIX)
regular expression.</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-pass-remarks-missed">
<code class="sig-name descname">-pass-remarks-missed</code><code class="sig-prename descclassname">=&lt;regex&gt;</code><a class="headerlink" href="#cmdoption-pass-remarks-missed" title="Permalink to this definition">¶</a></dt>
<dd><p>Enables missed optimization remarks from passes whose name match the given
(POSIX) regular expression.</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-pass-remarks-analysis">
<code class="sig-name descname">-pass-remarks-analysis</code><code class="sig-prename descclassname">=&lt;regex&gt;</code><a class="headerlink" href="#cmdoption-pass-remarks-analysis" title="Permalink to this definition">¶</a></dt>
<dd><p>Enables optimization analysis remarks from passes whose name match the given
(POSIX) regular expression.</p>
</dd></dl>

</div>
<div class="section" id="serialized-remarks">
<h3><a class="toc-backref" href="#id4">Serialized remarks</a><a class="headerlink" href="#serialized-remarks" title="Permalink to this headline">¶</a></h3>
<p>While diagnostics are useful during development, it is often more useful to
refer to optimization remarks post-compilation, typically during performance
analysis.</p>
<p>For that, LLVM can serialize the remarks produced for each compilation unit to
a file that can be consumed later.</p>
<p>By default, the format of the serialized remarks is <a class="reference internal" href="#yamlremarks"><span class="std std-ref">YAML</span></a>, and it can be accompanied by a <a class="reference internal" href="#remarkssection"><span class="std std-ref">section</span></a>
in the object files to easily retrieve it.</p>
<p><a class="reference internal" href="CommandGuide/llc.html"><span class="doc">llc</span></a> and <a class="reference internal" href="CommandGuide/opt.html"><span class="doc">opt</span></a> support the
following options:</p>
<p><code class="docutils literal notranslate"><span class="pre">Basic</span> <span class="pre">options</span></code></p>
<blockquote>
<div><dl class="std option">
<dt id="cmdoption-pass-remarks-output">
<code class="sig-name descname">-pass-remarks-output</code><code class="sig-prename descclassname">=&lt;filename&gt;</code><a class="headerlink" href="#cmdoption-pass-remarks-output" title="Permalink to this definition">¶</a></dt>
<dd><p>Enables the serialization of remarks to a file specified in &lt;filename&gt;.</p>
<p>By default, the output is serialized to <a class="reference internal" href="#yamlremarks"><span class="std std-ref">YAML</span></a>.</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-pass-remarks-format">
<code class="sig-name descname">-pass-remarks-format</code><code class="sig-prename descclassname">=&lt;format&gt;</code><a class="headerlink" href="#cmdoption-pass-remarks-format" title="Permalink to this definition">¶</a></dt>
<dd><p>Specifies the output format of the serialized remarks.</p>
<p>Supported formats:</p>
<ul class="simple">
<li><p><a class="reference internal" href="#yamlremarks"><span class="std std-ref">yaml</span></a> (default)</p></li>
</ul>
</dd></dl>

</div></blockquote>
<p><code class="docutils literal notranslate"><span class="pre">Content</span> <span class="pre">configuration</span></code></p>
<blockquote>
<div><dl class="std option">
<dt id="cmdoption-pass-remarks-filter">
<code class="sig-name descname">-pass-remarks-filter</code><code class="sig-prename descclassname">=&lt;regex&gt;</code><a class="headerlink" href="#cmdoption-pass-remarks-filter" title="Permalink to this definition">¶</a></dt>
<dd><p>Only passes whose name match the given (POSIX) regular expression will be
serialized to the final output.</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-pass-remarks-with-hotness">
<code class="sig-name descname">-pass-remarks-with-hotness</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pass-remarks-with-hotness" title="Permalink to this definition">¶</a></dt>
<dd><p>With PGO, include profile count in optimization remarks.</p>
</dd></dl>

<dl class="std option">
<dt id="cmdoption-pass-remarks-hotness-threshold">
<code class="sig-name descname">-pass-remarks-hotness-threshold</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-pass-remarks-hotness-threshold" title="Permalink to this definition">¶</a></dt>
<dd><p>The minimum profile count required for an optimization remark to be
emitted.</p>
</dd></dl>

</div></blockquote>
<p>Other tools that support remarks:</p>
<p><strong class="program">llvm-lto</strong></p>
<blockquote>
<div><dl class="std option">
<dt id="cmdoption-lto-pass-remarks-output">
<code class="sig-name descname">-lto-pass-remarks-output</code><code class="sig-prename descclassname">=&lt;filename&gt;</code><a class="headerlink" href="#cmdoption-lto-pass-remarks-output" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="std option">
<dt id="cmdoption-lto-pass-remarks-filter">
<code class="sig-name descname">-lto-pass-remarks-filter</code><code class="sig-prename descclassname">=&lt;regex&gt;</code><a class="headerlink" href="#cmdoption-lto-pass-remarks-filter" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="std option">
<dt id="cmdoption-lto-pass-remarks-format">
<code class="sig-name descname">-lto-pass-remarks-format</code><code class="sig-prename descclassname">=&lt;format&gt;</code><a class="headerlink" href="#cmdoption-lto-pass-remarks-format" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="std option">
<dt id="cmdoption-lto-pass-remarks-with-hotness">
<code class="sig-name descname">-lto-pass-remarks-with-hotness</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-lto-pass-remarks-with-hotness" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="std option">
<dt id="cmdoption-lto-pass-remarks-hotness-threshold">
<code class="sig-name descname">-lto-pass-remarks-hotness-threshold</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-lto-pass-remarks-hotness-threshold" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div></blockquote>
<p><strong class="program">gold-plugin</strong> and <strong class="program">lld</strong></p>
<blockquote>
<div><dl class="std option">
<dt id="cmdoption-opt-remarks-filename">
<code class="sig-name descname">-opt-remarks-filename</code><code class="sig-prename descclassname">=&lt;filename&gt;</code><a class="headerlink" href="#cmdoption-opt-remarks-filename" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="std option">
<dt id="cmdoption-opt-remarks-filter">
<code class="sig-name descname">-opt-remarks-filter</code><code class="sig-prename descclassname">=&lt;regex&gt;</code><a class="headerlink" href="#cmdoption-opt-remarks-filter" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="std option">
<dt id="cmdoption-opt-remarks-format">
<code class="sig-name descname">-opt-remarks-format</code><code class="sig-prename descclassname">=&lt;format&gt;</code><a class="headerlink" href="#cmdoption-opt-remarks-format" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="std option">
<dt id="cmdoption-opt-remarks-with-hotness">
<code class="sig-name descname">-opt-remarks-with-hotness</code><code class="sig-prename descclassname"></code><a class="headerlink" href="#cmdoption-opt-remarks-with-hotness" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</div></blockquote>
</div>
</div>
<div class="section" id="yaml-remarks">
<span id="yamlremarks"></span><h2><a class="toc-backref" href="#id5">YAML remarks</a><a class="headerlink" href="#yaml-remarks" title="Permalink to this headline">¶</a></h2>
<p>A typical remark serialized to YAML looks like this:</p>
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="nn">---</span> <span class="kt">!&lt;TYPE&gt;</span>
<span class="nt">Pass</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">&lt;pass&gt;</span>
<span class="nt">Name</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">&lt;name&gt;</span>
<span class="nt">DebugLoc</span><span class="p">:</span> <span class="p p-Indicator">{</span><span class="nt"> File</span><span class="p">:</span> <span class="nv">&lt;file&gt;</span><span class="p p-Indicator">,</span><span class="nt"> Line</span><span class="p">:</span> <span class="nv">&lt;line&gt;</span><span class="p p-Indicator">,</span><span class="nt"> Column</span><span class="p">:</span> <span class="nv">&lt;column&gt;</span> <span class="p p-Indicator">}</span>
<span class="nt">Function</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">&lt;function&gt;</span>
<span class="nt">Hotness</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">&lt;hotness&gt;</span>
<span class="nt">Args</span><span class="p">:</span>
  <span class="p p-Indicator">-</span> <span class="nt">&lt;key&gt;</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">&lt;value&gt;</span>
    <span class="nt">DebugLoc</span><span class="p">:</span> <span class="p p-Indicator">{</span><span class="nt"> File</span><span class="p">:</span> <span class="nv">&lt;arg-file&gt;</span><span class="p p-Indicator">,</span><span class="nt"> Line</span><span class="p">:</span> <span class="nv">&lt;arg-line&gt;</span><span class="p p-Indicator">,</span><span class="nt"> Column</span><span class="p">:</span> <span class="nv">&lt;arg-column&gt;</span> <span class="p p-Indicator">}</span>
</pre></div>
</div>
<p>The following entries are mandatory:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;TYPE&gt;</span></code>: can be <code class="docutils literal notranslate"><span class="pre">Passed</span></code>, <code class="docutils literal notranslate"><span class="pre">Missed</span></code>, <code class="docutils literal notranslate"><span class="pre">Analysis</span></code>,
<code class="docutils literal notranslate"><span class="pre">AnalysisFPCommute</span></code>, <code class="docutils literal notranslate"><span class="pre">AnalysisAliasing</span></code>, <code class="docutils literal notranslate"><span class="pre">Failure</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;pass&gt;</span></code>: the name of the pass that emitted this remark.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;name&gt;</span></code>: the name of the remark coming from <code class="docutils literal notranslate"><span class="pre">&lt;pass&gt;</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;function&gt;</span></code>: the mangled name of the function.</p></li>
</ul>
<p>If a <code class="docutils literal notranslate"><span class="pre">DebugLoc</span></code> entry is specified, the following fields are required:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;file&gt;</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;line&gt;</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;column&gt;</span></code></p></li>
</ul>
<p>If an <code class="docutils literal notranslate"><span class="pre">arg</span></code> entry is specified, the following fields are required:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;key&gt;</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;value&gt;</span></code></p></li>
</ul>
<p>If a <code class="docutils literal notranslate"><span class="pre">DebugLoc</span></code> entry is specified within an <code class="docutils literal notranslate"><span class="pre">arg</span></code> entry, the following
fields are required:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;arg-file&gt;</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;arg-line&gt;</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;arg-column&gt;</span></code></p></li>
</ul>
</div>
<div class="section" id="opt-viewer">
<h2><a class="toc-backref" href="#id6">opt-viewer</a><a class="headerlink" href="#opt-viewer" title="Permalink to this headline">¶</a></h2>
<p>The <code class="docutils literal notranslate"><span class="pre">opt-viewer</span></code> directory contains a collection of tools that visualize and
summarize serialized remarks.</p>
<div class="section" id="opt-viewer-py">
<span id="optviewerpy"></span><h3><a class="toc-backref" href="#id7">opt-viewer.py</a><a class="headerlink" href="#opt-viewer-py" title="Permalink to this headline">¶</a></h3>
<p>Output a HTML page which gives visual feedback on compiler interactions with
your program.</p>
<blockquote>
<div><dl class="field-list simple">
<dt class="field-odd">Examples</dt>
<dd class="field-odd"><p></p></dd>
</dl>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ opt-viewer.py my_yaml_file.opt.yaml
</pre></div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ opt-viewer.py my_build_dir/
</pre></div>
</div>
</div></blockquote>
</div>
<div class="section" id="opt-stats-py">
<h3><a class="toc-backref" href="#id8">opt-stats.py</a><a class="headerlink" href="#opt-stats-py" title="Permalink to this headline">¶</a></h3>
<p>Output statistics about the optimization remarks in the input set.</p>
<blockquote>
<div><dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p></p></dd>
</dl>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ opt-stats.py my_yaml_file.opt.yaml

Total number of remarks           3


Top 10 remarks by pass:
  inline                         33%
  asm-printer                    33%
  prologepilog                   33%

Top 10 remarks:
  asm-printer/InstructionCount   33%
  inline/NoDefinition            33%
  prologepilog/StackSize         33%
</pre></div>
</div>
</div></blockquote>
</div>
<div class="section" id="opt-diff-py">
<h3><a class="toc-backref" href="#id9">opt-diff.py</a><a class="headerlink" href="#opt-diff-py" title="Permalink to this headline">¶</a></h3>
<p>Produce a new YAML file which contains all of the changes in optimizations
between two YAML files.</p>
<p>Typically, this tool should be used to do diffs between:</p>
<ul class="simple">
<li><p>new compiler + fixed source vs old compiler + fixed source</p></li>
<li><p>fixed compiler + new source vs fixed compiler + old source</p></li>
</ul>
<p>This diff file can be displayed using <a class="reference internal" href="#optviewerpy"><span class="std std-ref">opt-viewer.py</span></a>.</p>
<blockquote>
<div><dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p></p></dd>
</dl>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ opt-diff.py my_opt_yaml1.opt.yaml my_opt_yaml2.opt.yaml -o my_opt_diff.opt.yaml
$ opt-viewer.py my_opt_diff.opt.yaml
</pre></div>
</div>
</div></blockquote>
</div>
</div>
<div class="section" id="emitting-remark-diagnostics-in-the-object-file">
<span id="remarkssection"></span><h2><a class="toc-backref" href="#id10">Emitting remark diagnostics in the object file</a><a class="headerlink" href="#emitting-remark-diagnostics-in-the-object-file" title="Permalink to this headline">¶</a></h2>
<p>A section containing metadata on remark diagnostics will be emitted when
-remarks-section is passed. The section contains:</p>
<ul class="simple">
<li><p>a magic number: “REMARKS\0”</p></li>
<li><p>the version number: a little-endian uint64_t</p></li>
<li><p>the total size of the string table (the size itself excluded):
little-endian uint64_t</p></li>
<li><p>a list of null-terminated strings</p></li>
<li><p>the absolute file path to the serialized remark diagnostics: a
null-terminated string.</p></li>
</ul>
<p>The section is named:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">__LLVM,__remarks</span></code> (MachO)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">.remarks</span></code> (ELF)</p></li>
</ul>
</div>
<div class="section" id="c-api">
<h2><a class="toc-backref" href="#id11">C API</a><a class="headerlink" href="#c-api" title="Permalink to this headline">¶</a></h2>
<p>LLVM provides a library that can be used to parse remarks through a shared
library named <code class="docutils literal notranslate"><span class="pre">libRemarks</span></code>.</p>
<p>The typical usage through the C API is like the following:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">LLVMRemarkParserRef</span> <span class="n">Parser</span> <span class="o">=</span> <span class="n">LLVMRemarkParserCreateYAML</span><span class="p">(</span><span class="n">Buf</span><span class="p">,</span> <span class="n">Size</span><span class="p">);</span>
<span class="n">LLVMRemarkEntryRef</span> <span class="n">Remark</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
<span class="k">while</span> <span class="p">((</span><span class="n">Remark</span> <span class="o">=</span> <span class="n">LLVMRemarkParserGetNext</span><span class="p">(</span><span class="n">Parser</span><span class="p">)))</span> <span class="p">{</span>
   <span class="c1">// use Remark</span>
   <span class="n">LLVMRemarkEntryDispose</span><span class="p">(</span><span class="n">Remark</span><span class="p">);</span> <span class="c1">// Release memory.</span>
<span class="p">}</span>
<span class="kt">bool</span> <span class="n">HasError</span> <span class="o">=</span> <span class="n">LLVMRemarkParserHasError</span><span class="p">(</span><span class="n">Parser</span><span class="p">);</span>
<span class="n">LLVMRemarkParserDispose</span><span class="p">(</span><span class="n">Parser</span><span class="p">);</span>
</pre></div>
</div>
</div>
</div>


            <div class="clearer"></div>
          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="Atomics.html" title="LLVM Atomic Instructions and Concurrency Guide"
             >next</a> |</li>
        <li class="right" >
          <a href="BuildingADistribution.html" title="Building a Distribution of LLVM"
             >previous</a> |</li>
  <li><a href="http://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="index.html">Documentation</a>&raquo;</li>

        <li class="nav-item nav-item-this"><a href="">Remarks</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2003-2020, LLVM Project.
      Last updated on 2020-09-20.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
    </div>
  </body>
</html>